
package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class Address extends IdObjectImpl implements IdObject
{
  private static final long serialVersionUID = -3783913234598915944L;

  private String city;

	private String country;
	private String streetName;
	private String zip;

	private Set<Company> branchCompanies;
	private Set<Company> companies;
	private Set<Person> persons;

	public Address()
	{
		super();
	}

	public Address(String streetName, String city, String country, String zip)
	{
		super();
		setStreetName(streetName);
		setCity(city);
		setCountry(country);
		setZip(zip);
	}

	public String getCity()
	{
		return city;
	}

	public String getCountry()
	{
		return country;
	}

	public String getStreetName()
	{
		return streetName;
	}

	public String getZip()
	{
		return zip;
	}

	public void setCity(final String city)
	{
		this.city = city;
	}

	public void setStreetName(String streetName)
	{
		this.streetName = streetName;
	}

	public void setZip(final String zip)
	{
		this.zip = zip;
	}

	public Set<Person> getPersons()
	{
		return persons;
	}

	public List<Person> getPersonsAsList()
	{
		return new ArrayList<Person>(getPersons());
	}

	public void setPersons(Set<Person> persons)
	{
		this.persons = persons;
	}

	public Set<Company> getCompanies()
	{
		return companies;
	}

	public List<Company> getCompaniesAsList()
	{
		return new ArrayList<Company>(getCompanies());
	}

	public Set<Company> getBranchCompanies()
	{
		return branchCompanies;
	}

	public List<Company> getBranchCompaniesAsList()
	{
		return new ArrayList<Company>(getBranchCompanies());
	}

	public void setCountry(String country)
	{
		this.country = country;
	}

	public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("Address [city=");
		builder.append(city);
		builder.append(", country=");
		builder.append(country);
		builder.append(", streetName=");
		builder.append(streetName);
		builder.append(", zip=");
		builder.append(zip);
		builder.append(", toString()=");
		builder.append(super.toString());
		builder.append("]");
		return builder.toString();
	}
}
